const _ = require('lodash/fp')

/**
 * type Result = Err msg | Ok result
 */


module.exports = {
  strandard_response: ({ok = false,err = '',data = {}} = {}) => {
    return {ok,err,data}
  },
  Ok: result => {
    return {Ok: _.isNil(result) ? '' : result}
  },
  Err: msg => {
    return {Err: _.isString(msg) ? msg : ''}
  },
  User: ({user = '未定义',name = '未定义'} = {}) => {
    return {user,name}
  },
  Shop: ({shop = '未定义',name = '未定义'} = {}) => {
    return {shop,name}
  }
}